@extends('layouts.app')
@include('order.sidebar')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            <form method="post" action="{{ route('admin.order.store') }}" accept-charset="UTF-8" enctype="multipart/form-data">
                <input type="hidden"  name="_token" value="{{ csrf_token() }}"/>
                <input type="hidden" name="user_id" value="{{ $formData['user_id'] }}" />
                <input type="hidden" name="link_id" value="{{ $formData['link_id'] }}" />
                <input type="hidden" name="type" value="{{ $formData['type'] }}" />
                <input type="hidden" name="price" value="{{ $formData['price'] }}" />
                @if(!is_null($formData['bill']))
                    @foreach($formData['bill'] as $value)
                        <input type="hidden" name="bill[]" value="{{ $value }}" />
                    @endforeach
                @endif
                <div class="form-group">
                    <label for="name">推荐人: {{ $referrer }}</label>
                </div>
                <div class="form-group">
                    <label for="name">收货人</label>
                    <input name="name" id="name" class="form-control"/>
                </div>
                <div class="form-group">
                    <label for="mobile">电话</label>
                    <input name="mobile" id="mobile" class="form-control"/>
                </div>
                <div class="form-group">
                    <label for="address">详细地址</label>
                    <input name="address" id="address" class="form-control"/>
                </div>
                <div class="form-group">
                    <label for="">选择产品</label>
                </div>
                <div class="form-group form-inline">
                @foreach($data as $item)
                    <?php
                        $param = '';
                        foreach ($item->param as $key => $item1) {
                            $param .= $key.":".$item1." ";
                        }
                    ?>
                    <div class="col-md-4 col-sm-6 col-xs-10">
                        <input type="radio" name="spec" id="{{ "radio".$item->id }}" value="{{ $item->id }}" checked/>
                        <label for="{{ "radio".$item->id }}">{{ $param }}</label>
                    </div>
                @endforeach
                </div>
                <br />
                <button type="submit" class="form-control btn btn-success">创建订单</button>
            </form>
        </div>
    </div>
@endsection
@push('scripts')
    <script>

        $('.refund').on('click', function () {
            $("#hideForm form").attr('action', $(this).attr('data-url'));
            $("#hideForm").modal('show');
        });
        $('#closeHideForm').on('click', function () {
            $("#hideForm").modal('hide');
        });

        $('.change-price').on('click', function () {
            $("#hideForm form").attr('action', $(this).attr('data-url'));
            $("#hideForm").modal('show');
        });
    </script>
@endpush


